import Axios from "./index"
import { PAGECONFIG } from "../api"
// import axios from "axios"

//评论
export const comment = {
    getComment: (params: PAGECONFIG) => Axios.get(`/api/comment/`, { params }),
    // PassComment: <T>(id: T, data: { pass: boolean }) => Axios.patch(`/api/comment/${id}`, data),
    getAllComment: (params: PAGECONFIG) => Axios.get(`/api/article`, { params }),
    findComment: (params: any) => Axios.get(`/api/search/`, { params }),
    passComment: <T>(id: T, data: { pass: boolean }) => Axios.patch(`/api/comment/${id}`, data),
    deleteComment: <T>(id: T) => Axios.delete(`/api/comment/${id}`),
    //回复
    Recomment: <T>(data: T) => Axios.post(`/api/comment`, data)

}
export default comment

//登录
export const auth = {
    loginUser: <T>(data: T) => Axios.post(`/api/auth/login`, data)
}

//分页
export const pageList = {
    getPageList: (params: PAGECONFIG) => Axios.get(`/api/page`, { params })
}

//邮箱管理
export const emailList = {
    getEmailList: (params: PAGECONFIG) => Axios.get(`/api/smtp`, { params })
}


//知识手册
export const knowledgeList = {
    getknowledgeList: (params: PAGECONFIG) => Axios.get(`/api/knowledge`, { params }),
    //添加知识手册
    addKnow: <T>(data: T) => Axios.post(`/api/knowledge/book`, data)
}

//查找
export const Find = {
    getsearchList: (params: PAGECONFIG) => Axios.get(`/api/search`, { params }),
    deleteFindList: <T>(id: T) => Axios.delete(`/api/search/${id}`),
}


//分类
export const ClassfiyAll = {
    getAllClass: () => Axios.get(`/api/category`),
    // loginUser: <T>(data: T) => Axios.post(`/api/auth/login`, data)
    addClassfiy: <T>(data: T) => Axios.post(`/api/category`, data),
    //  PassComment: <T>(id: T, data: { pass: boolean }) => Axios.patch(`/api/comment/${id}`, data),
    updataClass: (id: string, data: any) => Axios.patch(`/api/category/${id}`, data),
    detaleClass: (id: string) => Axios.delete(`/api/category/${id}`)
}


//文件管理
export const FileCharge = {
    // getAllClass: () => Axios.get(`/api/category`),
    getFileList: (params: any) => Axios.get(`/api/file`, { params }),
}

//用户信息
export const Users = {
    // getFileList:(params: any)=>Axios.get(`/api/file`, { params }),
    getUserList: (params: any) => Axios.get(`/api/user`, { params }),
    //修改用户信息

    updateUserList: <T>(data: T) => Axios.post(`/api/user/update`, data)
}


//访问统计
export const Visits = {
    getVisitList: (params: any) => Axios.get(`/api/view`, { params }),
    delVisitList: <T>(id: T) => Axios.delete(`/api/view/${id}`),
}

//系统设置
export const Systems = {
    getSystemList: <T>(data: T) => Axios.post(`/api/setting`, data)
}


//工作台
export const Works = {
    getWorksList: (params: any) => Axios.get(`/api/article`, { params }),
}